home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / program / 441 / vdisrc12 / vdiinpt2.s < prev    next >
Text File  |  1990-11-23  |  7KB  |  196 lines

  1.  
  2. ;*========================================================================
  3. ;*
  4. ;* VDIFAST Public Domain VDI bindings.
  5. ;*
  6. ;*========================================================================
  7.  
  8.           .iif      !(^^macdef VContrl),.include  "vdimacro.s"
  9.           
  10. ;*************************************************************************
  11. ;*
  12. ;* Rarely-used input functions. 
  13. ;*  All those functions which have a 'request mode' and 'sample mode'. 
  14. ;* 
  15. ;*  I don't understand this stuff at all...
  16. ;*   That implies that this stuff is totally untested.
  17. ;*
  18. ;*************************************************************************
  19.           
  20. ;*------------------------------------------------------------------------
  21. ;* Set input mode.
  22. ;*------------------------------------------------------------------------
  23.  
  24. _vsin_mode::
  25.           .cargs    #8,.handle.w,.devtyp.w,.mode.w
  26.           link      a6,#-2
  27.  
  28.           VContrl   #33,,,#2
  29.           
  30.           subq.l    #4,sp               ;* -> ptsout
  31.           pea       -2(a6)              ;* -> intout
  32.           subq.l    #4,sp               ;* -> ptsin
  33.           pea       .devtyp(a6)         ;* -> intin
  34.           pea       16(sp)              ;* -> contrl
  35.  
  36.           jmp       vdicall
  37.  
  38. ;*------------------------------------------------------------------------
  39. ;* Input locator.
  40. ;*------------------------------------------------------------------------
  41.  
  42. _vsm_locator::
  43. _vrq_locator::
  44.           .cargs    #8,.handle.w,.x.w,.y.w,.xout.l,.yout.l,.term.l
  45.           link      a6,#-4              ;* Allocate ptsout[2].          
  46.  
  47.           VContrl   #28,,#1
  48.                     
  49.           pea       -4(a6)              ;* -> ptsout
  50.           move.l    .term(a6),-(sp)     ;* -> intout
  51.           pea       .x(a6)              ;* -> ptsin
  52.           subq.l    #4,sp               ;* -> intin
  53.           pea       16(sp)              ;* -> contrl
  54.  
  55.           moveq.l   #$73,d0
  56.           move.l    sp,d1
  57.           trap      #2
  58.           
  59.           move.l    .xout(a6),a0        ;* Return x
  60.           move.w    -4(a6),(a0)         ;* from ptsout[0].
  61.           move.l    .yout(a6),a0        ;* Return y
  62.           move.w    -2(a6),(a0)         ;* from ptsout[1].
  63.           
  64.           move.w    28(sp),d0           ;* Contrl[4] (number of intout's)
  65.           lsl.w     #1,d0               ;* Shifted by one, per specs, OR
  66.           or.w      24(sp),d0           ;* in Contrl[2] (number of ptsout's).
  67.  
  68.           unlk      a6
  69.           rts
  70.  
  71. ;*------------------------------------------------------------------------
  72. ;* Input valuator.
  73. ;*------------------------------------------------------------------------
  74.  
  75. _vsm_valuator::
  76.           link      a6,#-6
  77.           st        -6(a6)
  78.           bra.s     v_valuator
  79. _vrq_valuator::
  80.           link      a6,#-6
  81.           clr.b     -6(a6)
  82. v_valuator:
  83.           .cargs    #8,.handle.w,.valin.w,.valout.l,.term.l,.status.l
  84.           
  85.           VContrl   #29,,,#1
  86.           
  87.           subq.l    #4,sp               ;* -> ptsout
  88.           pea       -4(a6)              ;* -> intout
  89.           subq.l    #4,sp               ;* -> ptsin
  90.           pea       .valin(a6)          ;* -> intin
  91.           pea       16(sp)              ;* -> contrl
  92.  
  93.           moveq.l   #$73,d0
  94.           move.l    sp,d1
  95.           trap      #2
  96.           
  97.           move.l    .valout(a6),a0      ;* Return value      
  98.           move.w    -4(a6),(a0)         ;* from intout[0].
  99.           move.l    .term(a6),a0        ;* Return terminator
  100.           move.w    -2(a6),(a0)         ;* from intout[1].
  101.           
  102.           tst.b     -6(a6)              ;* Check sample-mode flag, if 
  103.           beq.s     .skip               ;* not sample mode, skip status.
  104.  
  105.           move.l    .status(a6),a0      ;* In sample mode, we have to return
  106.           move.w    28(sp),(a0)         ;* status from contrl[4].
  107. .skip:
  108.           unlk      a6
  109.           rts
  110.  
  111. ;*------------------------------------------------------------------------
  112. ;* Input choice, request mode.
  113. ;*------------------------------------------------------------------------
  114.  
  115. _vrq_choice::
  116.           .cargs    #8,.handle.w,.chin.w,.chout.l
  117.           link      a6,#0
  118.  
  119.           VContrl   #30,,,#1
  120.           
  121.           subq.l    #4,sp               ;* -> ptsout
  122.           move.l    .chout(a6),-(sp)    ;* -> intout
  123.           subq.l    #4,sp               ;* -> ptsin
  124.           pea       .chin(a6)           ;* -> intin
  125.           pea       16(sp)              ;* -> contrl
  126.  
  127.           jmp       vdicall
  128.           
  129. ;*------------------------------------------------------------------------
  130. ;* Input choice, sample mode.
  131. ;*------------------------------------------------------------------------
  132.  
  133. _vsm_choice::
  134.           .cargs    #8,.handle.w,.choice.l
  135.           link      a6,#0
  136.           
  137.           VContrl   #30
  138.           
  139.           subq.l    #4,sp               ;* -> ptsout
  140.           pea       .choice(a6)         ;* -> intout
  141.           subq.l    #8,sp               ;* -> intin
  142.           pea       16(sp)              ;* -> contrl
  143.  
  144.           moveq.l   #$73,d0
  145.           move.l    sp,d1
  146.           trap      #2
  147.           move.w    28(sp),d0           ;* Return status from contrl[4].
  148.           unlk      a6
  149.           rts
  150.  
  151. ;*------------------------------------------------------------------------
  152. ;* Input string.  
  153. ;*------------------------------------------------------------------------
  154.  
  155. _vsm_string::
  156. _vrq_string::
  157.           .cargs    #8,.handle.w,.maxlen.w,.echoflag.w,.echoxy.l,.string.l
  158.           link      a6,#-4
  159.  
  160.           move.w    .maxlen(a6),d0      ;* We have to allocate 'maxlen'
  161.           bpl.s     .notneg             ;* words of stack space to hold
  162.           neg.w     d0                  ;* the ADE-type string that VDI
  163. .notneg:                                ;* will return to us.  The maxlen
  164.           add.w     d0,d0               ;* value may be negative (flag for
  165.           sub.w     d0,sp               ;* VDI to return scancodes), so we
  166.           move.l    sp,-4(a6)           ;* use the abs value in that case.
  167.           
  168.           VContrl  #31,,#1,#2
  169.  
  170.           subq.l    #4,sp               ;* -> ptsout
  171.           move.l    -4(a6),-(sp)        ;* -> intout
  172.           move.l    .echoxy(a6),-(sp)   ;* -> ptsin
  173.           pea       .maxlen(a6)         ;* -> intin
  174.           pea       16(sp)              ;* -> contrl
  175.  
  176.           moveq.l   #$73,d0
  177.           move.l    sp,d1
  178.           trap      #2
  179.           
  180.           moveq.l   #0,d0               ;* Zero string length for return.
  181.           move.l    -4(a6),a0           ;* Pointer to ADE string on stack.
  182.           move.l    .string(a6),a1      ;* Pointer to caller's string area.
  183. .copyloop:
  184.           addq.w    #1,d0               ;* Count string byte.
  185.           move.w    (a0)+,d1            ;* Get a word from the ADE string,
  186.           move.b    d1,(a1)+            ;* store the low byte in the caller's
  187.           bne.s     .copyloop           ;* string, loop till NULL byte copied.
  188.           
  189.           subq.w    #1,d0               ;* Don't count nullterm byte.
  190.           
  191.           unlk      a6                  ;* Dealloc all stack space.
  192.           rts
  193.  
  194. ;*         end of code
  195.  
  196.